package ru.nsu.expertsystem.chucknorris.xml_parser.xml;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import org.simpleframework.xml.ElementList;
import org.simpleframework.xml.Root;
import org.simpleframework.xml.Text;

@Root(name = "predicate")
public class XmlPredicate {
	@org.simpleframework.xml.Attribute(name = "className")
	private String className;
	
	@ElementList( inline = true)
	private ArrayList<Attribute> attributes;
	
	public String getClassName() {
		return className;
	}

	public List<Attribute> getAttributes() {
		if(attributes == null)
			return null;
		return Collections.unmodifiableList(attributes);
	}




	@Root(name = "attribute")
	public static class Attribute {
		@org.simpleframework.xml.Attribute(name = "name")
		private String name;
		
		/**
		 * Specifies class, containing constant, if object of this attribute is constant. May be null.
		 */
		@org.simpleframework.xml.Attribute(name = "constClass", required = false)
		private String constClassName;
		
		@Text
		private String objectName;
		
		
		public String getName() {
			return name;
		}
		
		public String getObjectName() {
			return objectName;
		}

		public String getConstClassName() {
			return constClassName;
		}
		
	}
}


